/*******************************************************************************
 * Copyright 2011 alipay.com
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/

package com.alipay.platform.data.impl;

import java.util.ArrayList;

/**
 * 数据持久化
 * @author sanping.li@alipay.com
 *
 */
public interface DataAccessor {
	/**
	 * 存储路径或数据库名
	 */
	public String getPath();
	
	/**
	 * 版本
	 */
	public int getVersion();
	
	/**
	 * 删除
	 * @param clazz
	 * @param selection
	 * @param selectionArgs
	 * @return
	 */
	public int delete(Class<?> clazz, String selection, String[] selectionArgs);
	
	/**
	 * 添加或更新
	 * @param object
	 * @return
	 * @throws Exception
	 */
	public long write(Object object) throws Exception;
	
	/**
	 * 读取
	 * @param clazz
	 * @param selection
	 * @param selectionArgs
	 * @param sortOrder
	 * @return
	 * @throws Exception
	 */
	public ArrayList<Object> read(Class<?> clazz, String selection, String[] selectionArgs,String sortOrder) throws Exception;
}
